package com.ydgk.servlet;

import com.ydgk.bean.Supplier;
import com.ydgk.dao.SupplierDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "SupplierFindByIdServlet", urlPatterns = "/SupplierFindByIdServlet.action")
public class SupplierFindByIdServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String sid = request.getParameter("sid");
        String pageNumber = request.getParameter("pageNumber");
        SupplierDao supplierDao = new SupplierDao();
        Supplier supplier = supplierDao.findById(Integer.parseInt(sid));
        request.setAttribute("supplier",supplier);
        request.setAttribute("pageNumber",pageNumber);
        request.getRequestDispatcher("supplierinformation.jsp?target='mainFrame'").forward(request,response);
    }


}
